<!DOCTYPE html>
<uieip type="page" value="login" debug="true" timeout="5000"></uieip>
<uieip type="reg" value="console,model" />
<html>

<head>
    <uieip type="file" value="inc" src="/yqwin/easyui/include.txt" cache="true" minute="1440"></uieip>
    <uieip type="file" value="css" src="/yqwin/css/yqwin.min"></uieip>
    <uieip type="file" value="js" src="/yqwin/src/yqwin.min"></uieip>
    <uieip type="tmpl" value="model.title"></uieip>
</head>

<body style="margin: 0;">
    <table id="tb_cms">
    </table>
    <script>
        <uieip type="tmpl" value="model.params"></uieip>

        $(function () {
            main_fun.init();
        });

        var page_fun = {
            init: function () {
                $(window).resize(function () {
                    page_fun.onresize();
                });
                page_fun.onresize();

                main_fun.load_data();
            },
            onresize: function () {
                main_fun.resize({
                    width: $(window).width(),
                    height: $(window).height()
                });
            }
        }

        var main_fun = {
            id: "tb_cms",
            init: function () {
                var opt = $.extend(_tb, {
                    loadData: false,
                    afterBindingTitle: function () {
                        page_fun.init();
                    },
                    onBeforeShowEdit: function (titles, action, row, callback) {      //add/upp/move 编辑执行前
                        //console.log("onBeforeShowEdit", action, row);
                        if (action == "add") {
                            row["time"] = new Date();
                        }
                        callback(true, titles, row);      //true 执行编辑
                    },
                });

                $("#" + main_fun.id).yqDataGrid(opt);
            },
            load_data: function () {
                $("#" + main_fun.id).yqDataGrid("loadData");
            },
            resize: function (para) {
                $("#" + main_fun.id).yqDataGrid('resize', para);
            }
        }
    </script>
</body>

</html>